package com.pharmacy.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Knife4jConfiguration {

    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("妙妙药品药店管理系统")
                        .version("1.0")
                        .description("妙妙药品药店管理系统接口文档")
                );
    }

    @Bean
    public GroupedOpenApi userAPI() {
        return GroupedOpenApi.builder().group("员工管理").
                pathsToMatch("/admin/employees/**")
                .build();
    }

    @Bean
    public GroupedOpenApi medicineAPI() {
        return GroupedOpenApi.builder().group("药品管理")
                .pathsToMatch("/admin/medicines/**")
                .build();
    }

    @Bean
    public GroupedOpenApi categoriesAPI() {
        return GroupedOpenApi.builder().group("分类管理")
                .pathsToMatch("/admin/categories/**")
                .build();
    }
    @Bean
    public GroupedOpenApi commonAPI() {
        return GroupedOpenApi.builder().group("通用接口")
                .pathsToMatch("/admin/common/**")
                .build();
    }

    @Bean
    public GroupedOpenApi payAPI() {
        return GroupedOpenApi.builder().group("支付接口")
                .pathsToMatch("/admin/alipay/**")
                .build();
    }

    @Bean
    public GroupedOpenApi expiredDrugsAPI() {
        return GroupedOpenApi.builder().group("过期药物接口")
                .pathsToMatch("/admin/expiredDrugs/**")
                .build();
    }

    @Bean
    public GroupedOpenApi orderAPI() {
        return GroupedOpenApi.builder().group("订单接口")
                .pathsToMatch("/admin/orders/**")
                .build();
    }
}
